找传奇、传世资源到传世资源站!
VB编程 正文

vb时间计时器(源码)

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

时间计时器,学VB入门实例vb时间计时器(源码) VB编程-第1张 Option Explicit
Private A As Integer, SS As Double, T1 As Date, T2 As Date

Private Sub Form_Load()     '软件打开时初始化
    A = 0: SS = 0: T1 = Now(): T2 = Now()
End Sub

Private Sub Timer1_Timer()    '刷新显示
    Label5.Caption = Format(Now, "Long Time")   '显示当时时间
    If A = 1 Then   '允许计时
        SS = DateDiff("s", T1, Now)
        Label2.Caption = SS Mod 60
        Label3.Caption = Int((SS Mod 3600) / 60)
        Label4.Caption = Int(SS / 3600)
    End If
End Sub

Private Sub Command1_Click()    '开始暂停
    If A = 1 Then   '按下暂停
        A = 2: T2 = Now()
    Else   '按下开始或继续
        A = 1: T1 = DateAdd("S", -DateDiff("s", T1, T2), Now())
    End If
End Sub

Private Sub Command2_Click()    '停止清零
    Label2.Caption = "0": Label3.Caption = "0": Label4.Caption = "0"
    A = 0: T1 = Now(): T2 = Now()
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) '关闭软件时
End Sub

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复